<script type="text/html" template>
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/reset.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/moneyManage/ClassManage.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/page.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/patrol/project_device_alert.css">
</script>
<!-- 第一个表格的 -->
<script type="text/html" id="caoZuo">
        <i class="layui-icon layui-icon-edit" style="cursor:pointer" lay-event="edit"></i>
        <i class="layui-icon layui-icon-delete" style="padding-left: 10px; cursor:pointer" lay-event="delete"></i>
</script>
<style scoped>
    .leon-style-alert .con2 input{
        margin-right: 0px;
    }
    .layui-content{
        padding-left: 0px;
        padding-right: 24px;
    }
    .ClassButton button:nth-child(1),.ClassButtonTwo button:nth-child(1){
      width: 60px;
      font-size: 11px;
      margin: 0;
      padding: 0 5px;
      border: 0;
      text-align: center;
      background-color: #FF4C4C;
      line-height: 22px;
      height: 22px;
      vertical-align: middle;
    }
</style>
<!--头部的表格 -->
<div class="layui-fluid">
    <div class="layui-row">
        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12 ClassTable">
            <!-- 第一个表格 -->
            <table id="shiftManagementSup" lay-even lay-skin="nob" class="layui-table" lay-filter="shiftManagementSup">

            </table>
            <!-- 按钮组合 -->
            <div class="ClassButton">
                <button type="button" class="layui-btn layui-btn-radius layui-btn-primary" data-type="deleteMore">
                    <i class="layui-icon layui-icon-delete" style="font-size: 15px;vertical-align: top;"></i>
                    <span>删除</span>
                </button>

                <button type="button" class="addClassBtn layui-btn layui-btn-radius layui-btn-primary"
                    data-type="addNewClass">
                    <i class="layui-icon layui-icon-add-circle" style="font-size: 15px;vertical-align: top;"></i>
                    <span>新增班次</span>
                </button>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="onlyDel">
    <i class="layui-icon layui-icon-delete" style="cursor:pointer" lay-event="deleteElement"></i>
</script>

<!-- 第二个表格 -->
<div class="layui-fluid">
    <input type="text" id="dataBase" style="display:none">
    <div class="row">
        <div class="layui-col-xs12 layui-col-sm12 layui-col-md12 ClassTableTwo">
            <table id="shiftManagementSubTwo" lay-even lay-skin="nob" class="layui-table"
                lay-filter="shiftManagementSubTwo"></table>
            <!-- 表格 -->
            <!-- 按钮组合 -->
            <div class="ClassButtonTwo">
                <button type="button" class="layui-btn layui-btn-radius layui-btn-primary" data-type="deleteFag">
                    <i class="layui-icon layui-icon-delete" style="font-size: 15px;vertical-align: top;"></i>
                    删除
                </button>
                <button type="button" class="addNewBtn layui-btn layui-btn-radius layui-btn-primary"
                    data-type="addPonser" style="line-height: 20px;background-color: #3D8CC9;">
                    <i class="layui-icon layui-icon-add-circle" style="font-size: 15px;"></i>
                    <span>新增人员</span>
                </button>
            </div>
        </div>
    </div>
</div>
<!-- 新增人员 -->
<script type="text/html" id="addDeviceTpl">
    <style scoped>
        .leon-style-alert .layui-table-page,.layui-table-page .layui-laypage input{
                background-color:transparent;   
           }
           .leon-style-alert .layui-table-view {
             border-width: 1px;
             border-style: solid;
             border-color: #e6e6e6;
         }
     </style>
<div class="leon-style-alert">
  <div class="layui-alert-box">
    <div class="layui-alert-title">
      <span class="layui-title-inner">添加人员</span>
      <span class="layui-title-screen">
        <div class="screen-btn">
          <form class="layui-form" action="">
            <input type="search" name="keyWord" class="search-blank-inner searchInput" placeholder="搜索" autocomplete="off"/>
            <button type="button" lay-submit lay-filter="queryTableDeviceHeader" class="search-blank-icon"></button>
          </form>
        </div>
      </span>
    </div>
    <div class="layui-content">
      <div class="con1 toggle-btn">
        <span class="screen">
          <i class="query-icon  layui-icon"></i>
          <span class="query-inner">查询条件</span>
        </span>
        <i class="icon layui-icon layui-icon-down"></i>
      </div>
      <div class="con2 toggle-content">
        <form action="" class="layui-form">
          <label for="">工号:</label>
          <input type="text" name="job" />
          <label for="">姓名:</label>
          <input type="text" name="gen02" />
          <label for="">部门:</label>
          <input type="text" name="gem02" />
          <button type="button" lay-submit lay-filter="queryTableDevice"
            class="query layui-btn layui-btn-radius layui-btn-primary">
            <span class="search-icon"></span>
            <span class="btn-inner">查询</span>
          </button>
        </form>
      </div>
      <table class="layui-table" id="table-device-alert" style="margin-top:20px;"></table>
    </div>
    <div class="footer layui-btn-containner" style="margin-top:20px;">
      <button class="btn1 layui-btn layui-btn-radius layui-btn-primary">添加</button>
      <button class="btn2 layui-btn layui-btn-radius layui-btn-primary">取消</button>
    </div>
  </div>
</div>
</script>
<script>
    layui.use(['admin', 'form', 'user', 'table', 'api', 'laytpl', 'utill', 'laydate', 'view', 'layer'], function () { //此段代码必不可少
        var $ = layui.$,
            admin = layui.admin,
            view = layui.view,
            api = layui.api,
            table = layui.table,
            setter = layui.setter,
            laytpl = layui.laytpl,
            utill = layui.utill,
            laydate = layui.laydate,
            form = layui.form,
            layer = layui.layer;
        // 选择上面的表格
        table.on('row(shiftManagementSup)', function(obj){
            $(".layui-table-body tr:nth-child(even)").attr({"style":"background:#ccdae3"});
            $(".layui-table-body tr:nth-child(odd)").attr({"style":"background:#FFFFFF"});
            $(this).attr({"style":"background:#999999"});
        });
        rander();  //调用这个方法
        function rander() {
            // 列定制
            utill.columnCustom('#shiftManagementSup', "HrShiftVO", {
                url: api.host + api.selectHrShiftList,
                toolbar: {
                    toolbar: '#caoZuo',
                    title: '操作',
                    event: 'detail',
                    align: 'center'
                },
            });
            table.on('tool(shiftManagementSup)', function (obj) {
                var data = obj.data
                if (obj.event === 'edit') {
                        admin.req({
                            type: "post",
                            url: api.host + api.ispermit_zfj,
                            data: {
                                prmit: 'TcEamHrShiftController:Shift'
                            },
                            success: function (response) {
                                console.log(response)
                                if (!response.data) {
                                    layer.msg('对不起，您没有权限！');
                                   return;
                                }else{
                                    admin.popup({
                                        title: '编辑',
                                        area: ['400px', '550px'],
                                        id: 'LAY-popup-user-add',
                                        success: function (layero, index) {
                                            view(this.id).render('moneyManage/alert/classMeage', data).done(function () {
                                                //   console.log(data);
                                                  // 站别
                                                  cf(data)
                                                  lc(data)
                                                  zb(data)
                                                  xb(data)  
                                                  function lc(data){
                                                      if(data.ftyName){
                                                          console.log(data.ftyName)
                                                        $('#selectFour').removeAttr('disabled');
                                                            admin.req({
                                                                url: api.host + api.selectFtyFlr,
                                                                // 第一个后台规定   第二个是自己定义或后台获取的
                                                                data: { ftyId: data.ftyName },
                                                                type: "get",
                                                                success: function (res) {
                                                                    console.log(res)
                                                                    var msg = res.data;
                                                                    if (msg != null || msg.size > 0) {
                                                                    var _msg = "";
                                                                    msg.forEach(item => {
                                                                        if(data.flrName == item.tcFlrName){
                                                                            _msg += `<option value=${item.tcFlrId} selected>${item.tcFlrName}</option>`;
                                                                        }
                                                                        _msg += `<option value=${item.tcFlrId}>${item.tcFlrName}</option>`;
                                                                    });
                                                                    $("#selectFour").html(_msg);
                                                                    form.render();
                                                                    }
                                                                }
                                                            });
                                                      }else{
                                                          admin.req({
                                                                url: api.host + api.selectFtyFlr,
                                                                // 第一个后台规定   第二个是自己定义或后台获取的
                                                                data: { ftyId: data.ftyName },
                                                                type: "get",
                                                                success: function (res) {
                                                                    var msg = res.data;
                                                                    if (msg != null || msg.size > 0) {
                                                                    var _msg = "";
                                                                    msg.forEach(item => {
                                                                        _msg += `<option value=${item.tcFlrId}>${item.tcFlrName}</option>`;
                                                                    });
                                                                    $("#selectFour").html(_msg);
                                                                    form.render();
                                                                    }
                                                                }
                                                            });
                                                      }
                                                  }
                                                  function cf(data){
                                                       // 厂房
                                                       var ftyName = {};
                                                       if(data){
                                                            admin.req({
                                                                url: api.host + api.selectGSFty,
                                                                data: ftyName,
                                                                type: "POST",
                                                                dataType: "json",
                                                                contentType: "application/json",
                                                                done: function (res) {
                                                                    var datas = res.data;
                                                                    if (datas != null || datas.size > 0) {
                                                                    var _cF = "<option></option>";
                                                                    datas.forEach(item => {
                                                                        if(data.ftyName == item.tcFtyName){
                                                                            _cF += `<option value=${item.tcFtyId} selected>${item.tcFtyName}</option>`;
                                                                        }
                                                                        _cF += `<option value=${item.tcFtyId}>${item.tcFtyName}</option>`;
                                                                    });
                                                                    $("#selectThree").html(_cF);
                                                                    form.render();
                                                                    }
                                                                }
                                                            });
                                                       }else{
                                                            admin.req({
                                                                url: api.host + api.selectGSFty,
                                                                data: ftyName,
                                                                type: "POST",
                                                                dataType: "json",
                                                                contentType: "application/json",
                                                                done: function (res) {
                                                                    var datas = res.data;
                                                                    if (datas != null || datas.size > 0) {
                                                                    var _cF = "<option></option>";
                                                                    datas.forEach(item => {
                                                                        _cF += `<option value=${item.tcFtyId}>${item.tcFtyName}</option>`;
                                                                    });
                                                                    $("#selectThree").html(_cF);
                                                                    form.render();
                                                                    }
                                                                }
                                                            });
                                                       }       
                                                  }
                                                   // 线别
                                                   function xb(data){
                                                       if(data){
                                                            view.req({
                                                                type: "post",
                                                                url: api.host + api.selectFiaLineId,
                                                                headers: {
                                                                    "Content-Type": "application/json"
                                                                },
                                                                success: function (res) {
                                                                    var list = res.data;
                                                                    if (list != null || list.size > 0) {
                                                                    var _list = "<option></option>";
                                                                    list.forEach(item => {
                                                                        if(data.lineName == item.tcLineName){
                                                                            _list += `<option value=${item.tcLineId} selected>${item.tcLineName}</option>`;
                                                                        }
                                                                        _list += `<option value=${item.tcLineId}>${item.tcLineName}</option>`;
                                                                    });
                                                                    $("#selectTwo").html(_list);
                                                                    form.render("select");
                                                                    }
                                                                }
                                                            });
                                                       }else{
                                                        view.req({
                                                                type: "post",
                                                                url: api.host + api.selectFiaLineId,
                                                                headers: {
                                                                    "Content-Type": "application/json"
                                                                },
                                                                success: function (res) {
                                                                    var list = res.data;
                                                                    if (list != null || list.size > 0) {
                                                                    var _list = "<option></option>";
                                                                    list.forEach(item => {
                                                                        _list += `<option value=${item.tcLineId}>${item.tcLineName}</option>`;
                                                                    });
                                                                    $("#selectTwo").html(_list);
                                                                    form.render("select");
                                                                    }
                                                                }
                                                            });
                                                       }
                                                   }                                            
                                                  function zb(data){
                                                    if(data){
                                                        admin.req({
                                                            type: "post",
                                                            url: api.host + api.selectFiaProcId,
                                                            dataType: "json",
                                                            contentType: "application/json",
                                                            success: function (response) {
                                                                var datas = response.data;
                                                                if (datas != null || datas.size > 0) {
                                                                var _select = "<option></option>";
                                                                datas.forEach(item => {
                                                                    if(data.procName == item.tcProcName){
                                                                        _select += `<option value="${item.tcProcId}" selected>${item.tcProcName}</option>`;
                                                                    }
                                                                    _select += `<option value="${item.tcProcId}">${item.tcProcName}</option>`;
                                                                });
                                                                $("#selectOne").html(_select);
                                                                form.render();
                                                                }
                                                            }
                                                            });
                                                    }else{
                                                        admin.req({
                                                            type: "post",
                                                            url: api.host + api.selectFiaProcId,
                                                            dataType: "json",
                                                            contentType: "application/json",
                                                            success: function (response) {
                                                                var datas = response.data;
                                                                if (datas != null || datas.size > 0) {
                                                                var _select = "<option></option>";
                                                                datas.forEach(item => {
                                                                    _select += `<option value="${item.tcProcId}">${item.tcProcName}</option>`;
                                                                });
                                                                $("#selectOne").html(_select);
                                                                form.render();
                                                                }
                                                            }
                                                        });
                                                    }
                                                  }
                                                
                                                form.render(null, 'shiftManagementSup');   // 渲染当前那的表格
                                                // 回显效果
                                                form.val("layuiadmin-form-tags", {
                                                    "tcShftId": data.tcShftId,               //班次代码
                                                    "tcShftName": data.tcShftName,           //班次名称
                                                    "startTime": data.startTime,             //上班时间
                                                    "endTime": data.endTime,                 //下班时间
                                                })
                                                form.on('submit(layuiadmin-app-form-submit)', function (data) {
                                                    // 把数据传递到后台
                                                    // endTime
                                                    data.field.tcShftStart1 = data.field.endTime
                                                    data.field.tcShftEnd1 = data.field.startTime 
                                                    delete data.field.endTime
                                                    delete data.field.startTime 
                                                    var field = data.field; //获取提交的字段
                                                    var fields = JSON.stringify(field);
                                                    admin.req({
                                                        // 编辑班次
                                                        url: api.host + api.updateShift,
                                                        type: 'post',
                                                        contentType: 'application/json',
                                                        dataType: 'json',
                                                        data: fields,
                                                        done: function (res) {
                                                            layui.table.reload('#shiftManagementSup'); //重载表格  
                                                            layer.close(index); //执行关闭 
                                                            layer.msg(res.message);
                                                        }
                                                    });
                                                });
                                                // 点击按钮关闭弹窗
                                                $('.layui-btn-container').on('click', '.cancel', function () {
                                                    layer.close(index);
                                                });
                                            });
                                        }
                                    });
                                }
                            }
                        })  
                }
                // 删除功能（上面的数据表格单行删除 success）
                else if (obj.event === 'delete') {
                    var tcShftId = obj.data.tcShftId;
                    var arr = [];
                    arr.push(tcShftId);
                    layer.confirm('真的删除吗？', function (index) {
                        admin.req({
                            url: api.host + api.deleteShift,
                            type: 'post',
                            contentType: 'application/json',
                            dataType: 'json',
                            data: JSON.stringify(arr),
                            //向服务端发送删除的id
                            done: function (res) {
                                layui.table.reload('#shiftManagementSup'); //重载表格
                                render1(-1);
                                layer.close(index); //执行关闭 
                                layer.msg(res.message);
                            }
                        })
                    })
                } else if (obj.event === 'detail') {
                    $("#dataBase").val(obj.data.tcShftId);
                    render1(obj.data.tcShftId);
                }
            });
        }
        render1(-1);
        function render1(tcShftId) {
            //  列定制
            utill.columnCustom('#shiftManagementSubTwo', "GenExParam", {
                // 自己表格的接口
                url: api.host + api.selectGenListByShiftId,
                where: { tcShftId: tcShftId },
                toolbar: {
                    toolbar: '#onlyDel',
                    title: '操作',
                    event: 'detail',
                    align: 'center'
                },
            });
            // 下面的表格删除事件(success) $("#dataBase").val()
            table.on('tool(shiftManagementSubTwo)', function (obj) {
                if (obj.event === 'deleteElement') {
                    var tcRlgsShftid = $("#dataBase").val();
                    var Gen01 = obj.data.gen01;
                    var arrays = [];
                    var obj = {
                        "tcRlgsGen01": Gen01,
                        "tcRlgsShftid": tcRlgsShftid
                    }
                    arrays.push(obj);
                    layer.confirm('真的删除吗？', function (index) {
                        admin.req({
                            url: api.host + api.deleteHrShift,
                            type: 'post',
                            dataType: 'json',
                            contentType: 'application/json',
                            data: JSON.stringify(arrays),
                            //删除成功后重新渲染表格
                            done: function (res) {
                                layer.msg(res.message);
                                layui.table.reload('#shiftManagementSubTwo');
                                layer.close(index);
                            }
                        })
                    })
                }
            })
        }
        // 添加人员弹出层
        $(".addNewBtn").click(function(){
            var checkStatus = table.checkStatus('#shiftManagementSup');
            if(checkStatus.data.length == 0){
               layer.msg("请先选勾选至少一个班次!");
            }else{
               layer.open({
                type: 1,
                title: false,
                area: ["665px", "536px"],
                fixed: true,
                shadeClose: true,
                closeBtn: 0,
                content: $("#addDeviceTpl").html(),
                success: active.addRoleAlert
            });
            }
        });
        //事件（data-type）
        var active = {
            // 员工录入弹出层
            addproduct: function () {
                admin.popup({
                    title: '员工录入',
                    area: ['392px', '399px'],
                    shadeClose: false,
                    id: 'LAY-popup-user-add',
                    success: function (layero, index) {
                        view(this.id).render('moneyManage/alert/InputPoser').done(function () {
                            //监听提交
                            form.on('submit(layuiadmin-app-form-submit)', function (data) {
                                var field = data.field; //获取提交的字段
                                var fieldOne = JSON.stringify(field);
                                admin.req({
                                    url: api.host + api.addGenEx,
                                    data: fieldOne,
                                    type: "POST",
                                    dataType: 'json',
                                    contentType: 'application/json',
                                    done: function (res) {
                                        layer.msg(res.message);
                                        layui.table.reload('shiftManagementSup'); //重载表格  
                                        layer.close(index); //执行关闭
                                    }
                                });
                            });
                        });
                    }
                });
            },
            // 多条删除{0}
            deleteMore: function () {
                var checkStatus = table.checkStatus('#shiftManagementSup');
                if (checkStatus.data.length == 0) {
                    parent.layer.msg('请至少选择一条要删除的数据', { icon: 2 });
                    return;
                }
                var number = []
                for (var i = 0; i < checkStatus.data.length; i++) {
                    number.push(checkStatus.data[i].tcShftId);
                }
                admin.req({
                    type: 'post',
                    dataType: 'json',
                    contentType: 'application/json',
                    url: api.host + api.deleteShift,
                    data: JSON.stringify(number),
                    success: function (data) {
                        layer.msg(data.message);
                        layui.table.reload('#shiftManagementSup'); //重载表格
                        render1(-1);
                        layer.close(index); //执行关闭 
                    }
                });
            },
            // 新增班次
            addNewClass: function () {
                admin.popup({
                    title: '新增班次',
                    area: ['400px', '500px'],
                    shadeClose: false,
                    id: 'LAY-popup-user-add',
                    success: function (layero, index) {
                        view(this.id).render('moneyManage/alert/addClass_alert').done(function () {
                            //监听提交
                            form.on('submit(layuiadmin-app-form-submit)', function (data) {
                                var field = data.field; //获取提交的字段
                                var fieldOne = JSON.stringify(field);
                                admin.req({
                                    url: api.host + api.insertShift,
                                    data: fieldOne,
                                    type: "POST",
                                    dataType: 'json',
                                    contentType: 'application/json',
                                    done: function (res) {
                                        layer.msg(res.message);
                                        layui.table.reload('#shiftManagementSup'); //重载表格  
                                        layer.close(index); //执行关闭 
                                    }
                                });
                            });
                            // 给取消按钮添加事件
                            $('.layui-form-item').on('click', '.btn2', function () {
                                layer.close(index);
                            });
                            // 再一次刷新表单
                            form.render();
                        });
                    }
                });
            },
            // 班次管理新增人员
            addRoleAlert:function(layero, index){
                 table.render(
                    $.extend({}, utill.tableOpts(), {
                    elem: "#table-device-alert",
                    id: "#table-device-alert",
                    height: 300,
                    toolbar: "",
                    url: api.host + api.selectNotHrShiftGen01_llp,
                    type: 'post',
                    cols: [
                        [
                        { fixed: "left", type: "checkbox" },
                        { field: "gen01", title: "工号" },
                        { field: "gen02", title: "姓名" },
                        { field: "gem02", title: "部门" },
                        { field: "tcHrJob", title: "岗位" }
                        ]
                    ]
                    })
               );
               $('.leon-style-alert .con1').click(function(){
                    $('.con2').toggle();
               })
                form.on("submit(queryTableDevice)", function (data) {
                    var allData = data.field;
                    table.reload("#table-device-alert", {
                    where: allData
                    });
                    return false;
                });
                form.on("submit(queryTableDeviceHeader)", function (data) {
                    var allData = data.field;
                    table.reload("#table-device-alert", {
                    where: allData
                    });
                    return false;
                });
                // 回车查询
                utill.keyup('.searchInput', '.search-blank-icon');
                // 添加人员
                var checkStatus = table.checkStatus('#shiftManagementSup');
                var number = []
                for (var i = 0; i < checkStatus.data.length; i++) {
                    number.push(checkStatus.data[i].tcShftId);
                }
                var tom = checkStatus.data[0].tcShftId;
                
                // 确定
                $(".btn1").click(function(){
                    var checkStatus = table.checkStatus('#table-device-alert');
                    if (checkStatus.data.length == 0) {
                        parent.layer.msg('请至少选择一个人员！', { icon: 2 });
                        return;
                   }
                   var arr = [];
                    for (var i = 0; i < checkStatus.data.length; i++) {
                        arr.push(checkStatus.data[i].gen01)
                    }
                     var obj = {
                                "tcRlgsGen01": arr,
                                "tcRlgsShftid": number
                            }
                    admin.req({
                    type: 'post',
                    dataType: 'json',
                    contentType: 'application/json',
                    url: api.host + api.insertPerson,
                    data: JSON.stringify(obj),
                    success: function (data) {   
                        if(data.code == 0){
                          layer.close(index);
                          render1(tom);
                          layer.msg(data.message);
                        }else{
                           layer.open({content:data.message});
                        }
                    }
                    });
                })
                // 取消
                $(".btn2").click(function(){
                 layer.closeAll();
                })
            },
            // addPonser: function () {   
            //     admin.popup({
            //         title: '新增人员',
            //         area: ['330px', '350px'],
            //         shadeClose: false,
            //         id: 'LAY-popup-user-add',
            //         success: function (layero, index) {
            //             view(this.id).render('moneyManage/alert/addNewPerone').done(function () {
            //                 //监听提交
            //                 form.on('submit(layuiadmin-app-form-submit)', function (data) {
            //                     var tcHrGen01 = data.field.tcHrGen01;
            //                     var obj = {
            //                         "tcRlgsGen01": tcHrGen01,
            //                         "tcRlgsShftid": $("#dataBase").val()
            //                     }
            //                     admin.req({
            //                         url: api.host + api.insertPerson,
            //                         type: "POST",
            //                         dataType: 'json',
            //                         contentType: 'application/json',
            //                         data: JSON.stringify(obj),
            //                         success: function (res) {
            //                             layer.msg(res.message);
            //                             render1($("#dataBase").val());
            //                             layer.close(index); //执行关闭 
            //                         }
            //                     });
            //                 });
            //                 // 给添加人员弹出层按钮取消
            //                 $(".layui-form-item").on("click", ".btn2", function () {
            //                     layer.close(index);
            //                 });
            //                 // 重新渲染
            //                 form.render();
            //             });
            //         }
            //     });
            // },

            // 下面表格(批量删除)
            deleteFag: function () {
                var checkStatus = table.checkStatus('#shiftManagementSubTwo');
                if (checkStatus.data.length == 0) {
                    parent.layer.msg('至少删除一个哟！', { icon: 2 });
                    return;
                }
                var numbers = [];
                for (var i = 0; i < checkStatus.data.length; i++) {
                    var obj = {
                        "tcRlgsGen01": checkStatus.data[i].gen01,
                        "tcRlgsShftid": $("#dataBase").val()
                    }
                    numbers.push(obj);
                }
                admin.req({
                    type: 'post',
                    dataType: 'json',
                    contentType: 'application/json',
                    url: api.host + api.deleteHrShift,
                    data: JSON.stringify(numbers),
                    success: function (data) {
                        // 操作成功提示
                        layer.msg("删除成功");
                        // 重载表格
                        layui.table.reload('#shiftManagementSubTwo'); //重载表格
                        // render1($("#dataBase").val());
                    }
                });
            }
        };
        utill.showAndHide('.layui-btn',"FiaFileController:insertFiaFile");
        // 给按钮添加事件
        $('.layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>